﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPIS.GERP.GFMS.MODEL;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.IDAL;
using KPIS.GERP.GFMS.DALFactory;

// test only
using KPIS.GERP.GFMS.DAL;

namespace KPIS.GERP.GFMS.BLL
{
    public class B_FIM_MAS_CalulateTaxs : IBLL_FIM_MAS_CalulateTaxs
    {
        Common common = new Common();
        private static readonly IDAL_FIM_MAS_CalulateTaxs dal = DataAccess.Create_FIM_MAS_CalulateTaxs();
        //D_FIM_MAS_Receives r = new D_FIM_MAS_Receives();

        public B_FIM_MAS_CalulateTaxs()
        {

        }

        public M_FIM_MAS_CalulateTaxs GetInfo(string seq)
        {
            int nSeq;
 
            if (seq == null)
                return null;

            if (common.IsNumeric(seq))
            {
                nSeq = int.Parse(seq);
                return dal.GetInfo(nSeq);
            }
            else
            {
                return null;
            }
        }

        public M_FIM_MAS_CalulateTaxs GetInfoFromYear(string pay_year)
        {
            int npay_year;

            if (pay_year == null)
                return null;

            if (common.IsNumeric(pay_year))
            {
                npay_year = int.Parse(pay_year);
                return dal.GetInfoFromYear(npay_year);
            }
            else
            {
                return null;
            }
        }

        public void Insert(M_FIM_MAS_CalulateTaxs info)
        {
            try
            {
                dal.Insert(info);
            }
            catch
            {
                throw;
            }
        }

        public void Update(M_FIM_MAS_CalulateTaxs info)
        {
            try
            {
                dal.Update(info);
            }
            catch
            {
                throw;
            }
        }
    }
}
